const antenna = {
  state: {
    antennaList: []
  },
  mutations: {
    setAntennaList (state, data) {
      state.antennaList = data
    }
  },
  actions: {
    async getAntennaList (context) {
      let response = await context.dispatch(`axios`, {
        method: 'get',
        url: '/api/abs/devices/antennas/'
      })
      context.commit('setAntennaList', response.data)
    }
  },
  getters: {
    antennaListOption (state) {
      return [...state.antennaList.map(item => {
        return {
          key: item.id,
          value: item.id,
          label: item.name
        }
      })]
    }
  }
}
export default antenna
